﻿using System;

namespace FadeLang.Ast
{
    public enum AssignmentOpType
    {
        Assignment,
        AddAssignment,
        SubAssignment,
        MulAssignment,
        DivAssignment,
        ModAssignment
    }

    public static class AssignmentOpTypeUtils
    {
        public static AssignmentOpType GetAssignmentOpType(string op) {
            switch (op) {
                case "=":
                    return AssignmentOpType.Assignment;
                case "+=":
                    return AssignmentOpType.AddAssignment;
                case "-=":
                    return AssignmentOpType.SubAssignment;
                case "*=":
                    return AssignmentOpType.MulAssignment;
                case "/=":
                    return AssignmentOpType.DivAssignment;
                case "%=":
                    return AssignmentOpType.ModAssignment;
                default:
                    throw new Exception();
            }
        }
    }

    internal class Assignment : Statement
    {
        public string Name { get; set; }
        public AssignmentOpType Op { get; set; }
        public Exp Value { get; set; }
    }
}